// 验证合法域名
export const validateDomain = (rule: any, value: any, callback: any) => {
  const reg = /^(?=^.{3,24}$)(?!^[0-9]+$)(?!^[0-9]+.[0-9]+$)([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+$/
  if (reg.test(value)) {
    callback()
  } else {
    callback(new Error('请输入合法的域名'))
  }
}
// 验证最后一位字符不能为/
export const lastStrDomain = (rule: any, value: any, callback: any) => {
  if (value.length) {
    let lastStr = value.charAt(value.length - 1)
    if (lastStr == '/') {
      callback(new Error('最后一位字符不能为/'))
    } else {
      callback()
    }
  } else {
    callback(new Error('请输入合法的域名'))
  }
}
